package com.autosalon.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name = "MODEL")
public class Model implements Serializable, IModelClass{
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "NAZEV_MODELU", length = 50, nullable = false)
    private String nazev_modelu;

    @ManyToOne(cascade =  {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
    @JoinColumn(name = "ID_VYROBCE")
    private Vyrobce vyrobce;

    @ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
    @JoinColumn(name = "ID_KATEGORIE")
    private Kategorie kategorie;

    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "ID_MODELU")
    private List<Automobil> automobily;

    @Override
	public Long getId() {
            return id;
    }

    public String getNazev_modelu() {
            return nazev_modelu;
    }

    public void setNazev_modelu(String nazev_modelu) {
            this.nazev_modelu = nazev_modelu;
    }

    public Kategorie getKategorie() {
            return kategorie;
    }

    public void setKategorie(Kategorie kategorie) {
            this.kategorie = kategorie;
    }

    public Vyrobce getVyrobce() {
            return vyrobce;
    }

    public void setVyrobce(Vyrobce vyrobce) {
            this.vyrobce = vyrobce;
    }

    public List<Automobil> getAutomobily() {
            return automobily;
    }

    public void setAutomobily(List<Automobil> automobily) {
            this.automobily = automobily;
    }
	
	
 
}
